package com.museum;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class Dashboard extends ListActivity {
	ListView lvMuseumAPI;
	String[] items_listview = new String[] { "mp.user.profile","mp.user.visit","mp.user.watched","mp.user.bookshelf","mp.places.museum","mp.places.items","mp.places.news"};
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.dashboard);

        bindWidget();
        setListViewEventListener();
    }
    private void bindWidget(){
    	setListAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, items_listview));
    	
    	lvMuseumAPI = getListView();
        lvMuseumAPI.setTextFilterEnabled(true);
        
    }
    private void setListViewEventListener(){
    	lvMuseumAPI.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) {
				// TODO Auto-generated method stub
				String item = (String) getListAdapter().getItem(arg2);
				Toast.makeText(getApplicationContext(),
						((TextView) arg1).getText(), Toast.LENGTH_SHORT).show();
				//Log.d("TAG", "Item: " + item);
				
				if(item.equals("mp.user.profile")){
					Intent intent = new Intent(getApplicationContext(), Mp_User_Profile_Activity.class); 
					startActivity(intent);
				}else if(item.equals("mp.user.visit")){
					Intent intent = new Intent(getApplicationContext(), Mp_User_Visit_Activity.class); 
					startActivity(intent);
				}
				else if(item.equals("mp.user.watched")){
					Intent intent = new Intent(getApplicationContext(), Mp_User_Watched_Activity.class); 
					startActivity(intent);		
				}
				else if(item.equals("mp.user.bookshelf")){
					Intent intent = new Intent(getApplicationContext(), Mp_User_BookShelf_Activity.class); 
					startActivity(intent);
				}
				else if(item.equals("mp.places.museum")){
					Intent intent = new Intent(getApplicationContext(), Mp_Places_Museum_Activity.class); 
					startActivity(intent);
				}
				else if(item.equals("mp.places.items")){
					Intent intent = new Intent(getApplicationContext(), Mp_Places_Items_Activity.class); 
					startActivity(intent);		
				}
				else if(item.equals("mp.places.news")){
					Intent intent = new Intent(getApplicationContext(), Mp_Places_News_Activity.class); 
					startActivity(intent);
				}
			}
    		
		});
    }

}
